import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ichinesereader/models/book/BookItem.dart';
import 'package:ichinesereader/widgets/grids/bookSLiderGridNoBar.dart';
import '../../controller/user.dart';

class RecommendBookDialog extends StatelessWidget {
  final List<BookItem> books;

  RecommendBookDialog({
    Key? key,
    required this.books,
  }) : super(key: key);

  final UserController _usersController = Get.find();

  @override
  Widget build(BuildContext context) {
    return AlertDialog(
      content: Container(
        height: 345,
        width: MediaQuery.of(context).size.width * 0.8,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            SizedBox(height: 10),
            // Text(
            //   'There are ${this.books.length} recommended books',
            //   style: TextStyle(fontSize: 20),
            // ),
            // SizedBox(height: 10),
            Flexible(
              child: Center(
                child: BookSliderGridNoBar(books: books),
                // _booksController.obx(
                //   (data) => BookGridWithCheckBox(
                //     books: _booksController.recommendedBookItems,
                //     readingType: NanhaiBookReadingTypes.leveled,
                //   ),
                //   //onEmpty: Text('Books not available'.tr),
                //   onLoading: Center(
                //       child: CircularProgressIndicator(
                //     backgroundColor: Get.theme.primaryColorDark,
                //     strokeWidth: 9.0,
                //   )),
                // ),
              ),
            ),
            MaterialButton(
                color: Get.theme.primaryColorDark,
                onPressed: () {
                  _usersController.refreshLevelPercentage();
                  Get.back();
                },
                child: Text(
                  'Close'.tr,
                  style: TextStyle(
                      color: Get.isDarkMode ? Colors.black : Colors.white),
                ))
          ],
        ),
      ),
    );
  }
}
